package j04zuoye;
/*
2,求最大值
有一组数据 10,8,23,41,52,66,34,12。编写代码求出数组中的最大值。
（用数组实现）
 */
public class J02max {
    public static void main(String[] args) {
        int arr[] = {10,8,23,41,52,66,34,12};
        int max = arr[0];
        for (int i = 1; i <= arr.length-1; i++) {
            if(max<arr[i]){
                int temp = arr[i];
                arr[i] = max;
                max = temp;
            }
        }
        System.out.println("max = " + max);
    }
}
